In the late 16th century, Spain saw a dramatic change as it became involved in a series of costly wars that resulted in Portugal and Catalonia gaining independence. Between the 18th and 19th centuries, Spain lost control of Cuba, Puerto Rico, the Philippines, and Guam to the United States after the Spanish-American War. In the early 20th century, Spain colonized parts of Africa and established dictators like Miguel Primo de Rivera until the Spanish Civil War began in 1936, resulting in Francisco Franco becoming dictator of Spain until 1955.